package ar.com.angrymachine.hunter.locations;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;

import ar.com.angrymachine.hunter.Activity;
import ar.com.angrymachine.hunter.GraphicStyles;
import ar.com.angrymachine.hunter.Locale;
import ar.com.angrymachine.hunter.HunterResourceManager;
import ar.com.angrymachine.hunter.activities.FightActivity;
import ar.com.angrymachine.hunter.gameplay.Monster;

public class ColossusHandActivity extends FightActivity
{
	ColossusActivitySet parentActivitySet;
	private String description;
	
	public ColossusHandActivity(ColossusActivitySet parentSet, String description, Monster handMonster)
	{
		super(handMonster);
		parentActivitySet = parentSet;
		this.description = description;
	}
	
	public String getActionText()
	{
		return Locale.AVOID;
	}

	public String getDescription()
	{
		return description;
	}

	public void onFinished(Activity parent)
	{
	}

	public void paint(Graphics g, Rectangle activityArea)
	{
        GraphicStyles.paintDefaultActivity(g, this, activityArea, HunterResourceManager.getImage("town-arena.png"));
        if(!isCompleted())
        {
        	Rectangle[] bars = GraphicStyles.getBarAreas(activityArea, 2);
            Image healthIcon = HunterResourceManager.getImage("heart-full.png");
            Image attackIcon = HunterResourceManager.getImage("attack.png");
        	int iconsWidth = Math.max(healthIcon.getWidth(null), attackIcon.getWidth(null));
        	// attack
            g.setColor(Color.YELLOW);
            GraphicStyles.paintIconizedBar(g, attackIcon, iconsWidth, bars[0], monster.timeToAttack, (int)monster.attackRate);
        }
	}

	public void update(int delta, boolean action, boolean timeIsRunning)
	{
		super.update(delta, action, timeIsRunning);
		if(timeIsRunning && action)
		{
			// take back the attack time
			monster.timeToAttack -= delta * 3;
		}
	}
}
